<?php

namespace maotool\src\test;

use maotool\core\Container;
use maotool\core\facade\Config;
use maotool\file\DirUtil;
use maotool\log\Console;
use maotool\orm\mapper\MapperUtil;
use maotool\orm\mapper\PageHelper;
use maotool\orm\mapper\PageInfo;
use maotool\orm\mapper\PageParam;
use maotool\util\EnvUtil;
use maotool\util\MaoToolUtil;
use PHPUnit\Framework\TestCase;

class OrmMapperTest extends TestCase
{

    public function testSelect()
    {
        EnvUtil::get();
        $log_time_start = microtime(true);
        MapperUtil::scan("maotool:/src/test/resources/**/*.xml");
        $param = new PageParam();
        $param->setPageNo(1);
        $param->setPageSize(10);
        PageHelper::startPage($param->getPageNo(), $param->getPageSize());
//        $list = Container::getClass("maotool\src\\test\UsersDao")->getList("beian");
        Console::debug('请求加载用时：' . number_format(microtime(true) - $log_time_start, 10) . ' 秒。');
        $lines = Console::$lines;
        foreach ($lines as $line) {
            echo json_encode($line["ages"], JSON_UNESCAPED_UNICODE) . "\n";
        }
        $this->assertTrue(true);
    }

    public function testIndex()
    {
        MapperUtil::scan("maotool:/src/test/resources/**/*.xml");
        $this->assertTrue(true);
    }

}